/*
 Navicat Premium Data Transfer

 Source Server         : one
 Source Server Type    : MySQL
 Source Server Version : 50710
 Source Host           : localhost:3306
 Source Schema         : elm

 Target Server Type    : MySQL
 Target Server Version : 50710
 File Encoding         : 65001

 Date: 27/04/2022 16:32:08
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for business
-- ----------------------------
DROP TABLE IF EXISTS `business`;
CREATE TABLE `business` (
  `businessId` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '商家编号',
  `businessName` varchar(40) NOT NULL COMMENT '商家名称',
  `businessAddress` varchar(50) DEFAULT NULL COMMENT '商家地址',
  `businessExplain` varchar(40) DEFAULT NULL COMMENT '商家介绍',
  `businessImg` mediumtext NOT NULL COMMENT '商家图片（base64）',
  `orderTypeId` int(11) NOT NULL COMMENT '点餐分类',
  `starPrice` decimal(5,2) DEFAULT '0.00' COMMENT '起送费',
  `deliveryPrice` decimal(5,2) DEFAULT '0.00' COMMENT '配送费',
  `remarks` varchar(40) DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`businessId`)
) ENGINE=InnoDB AUTO_INCREMENT=10010 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of business
-- ----------------------------
BEGIN;
INSERT INTO `business` VALUES (10001, '万家饺子（软件园E18店）', '沈阳浑南区软件园E18楼', '各种饺子', '', 1, 15.00, 3.00, NULL);
INSERT INTO `business` VALUES (10002, '小锅饭豆腐馆（全运店）', '沈阳市全运路126号', '小锅套餐', '', 1, 16.00, 2.50, NULL);
INSERT INTO `business` VALUES (10003, '麦当劳麦乐送（全运路店）', '沈阳市全运路53号麦当劳', '汉堡薯条', '', 4, 20.00, 4.00, NULL);
INSERT INTO `business` VALUES (10004, '米村拌饭（浑南店）', '沈阳市浑南区彩霞街26号', '拌饭套餐', '', 1, 15.00, 3.00, NULL);
INSERT INTO `business` VALUES (10005, '申记串道（中海康城店）', '沈阳市中海康城社区48号', '烤串炸串', '', 1, 18.00, 3.00, NULL);
INSERT INTO `business` VALUES (10006, '半亩良田排骨米饭', '沈阳市和平区文萃路58号', '排骨米饭', '', 1, 15.00, 3.50, NULL);
INSERT INTO `business` VALUES (10007, '茶兮鲜果饮品（国际软件园店）', '沈阳市国际软件园6号楼', '甜品饮品', '', 5, 20.00, 4.00, NULL);
INSERT INTO `business` VALUES (10008, '唯一水果捞（软件园E18店）', '沈阳市软件园E18楼', '新鲜水果', '', 1, 15.00, 3.50, NULL);
INSERT INTO `business` VALUES (10009, '满园春饼（全运路店）', '沈阳市全运路99号', '春饼炒菜', '', 1, 15.00, 3.00, NULL);
COMMIT;

-- ----------------------------
-- Table structure for cart
-- ----------------------------
DROP TABLE IF EXISTS `cart`;
CREATE TABLE `cart` (
  `cartId` int(11) NOT NULL AUTO_INCREMENT COMMENT '无意义编号',
  `foodId` int(11) NOT NULL COMMENT '食品编号',
  `businessId` int(11) NOT NULL COMMENT '所属商家编号',
  `userId` varchar(20) NOT NULL COMMENT '所属用户编号',
  `quantity` int(11) NOT NULL COMMENT '同一类型食品的购买数量',
  PRIMARY KEY (`cartId`)
) ENGINE=InnoDB AUTO_INCREMENT=46 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of cart
-- ----------------------------
BEGIN;
INSERT INTO `cart` VALUES (2, 1, 10001, '12345671111', 30);
COMMIT;

-- ----------------------------
-- Table structure for deliveryaddress
-- ----------------------------
DROP TABLE IF EXISTS `deliveryaddress`;
CREATE TABLE `deliveryaddress` (
  `daId` int(11) NOT NULL AUTO_INCREMENT COMMENT '送货地址编号',
  `contactName` varchar(20) NOT NULL COMMENT '联系人姓名',
  `contactSex` int(11) NOT NULL COMMENT '联系人性别',
  `contactTel` varchar(20) NOT NULL COMMENT '联系人电话',
  `address` varchar(100) NOT NULL COMMENT '送货地址',
  `userId` varchar(20) NOT NULL COMMENT '所属用户编号',
  PRIMARY KEY (`daId`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of deliveryaddress
-- ----------------------------
BEGIN;
INSERT INTO `deliveryaddress` VALUES (2, '习近平', 1, '12345671111', '北京市中南海', '12345671111');
INSERT INTO `deliveryaddress` VALUES (3, '特没谱', 1, '12345672222', '美国华盛顿白宫', '12345672222');
INSERT INTO `deliveryaddress` VALUES (4, 'test', 1, '123456', 'shen', '18041339618');
INSERT INTO `deliveryaddress` VALUES (5, 'fender', 1, '123456', 'shen', '18041339618');
INSERT INTO `deliveryaddress` VALUES (15, 'fender123', 1, '1122334455', 'shenyang', '11111111111');
INSERT INTO `deliveryaddress` VALUES (16, 'gibson', 1, '12121212', 'dalian', '11111111111');
COMMIT;

-- ----------------------------
-- Table structure for food
-- ----------------------------
DROP TABLE IF EXISTS `food`;
CREATE TABLE `food` (
  `foodId` int(11) NOT NULL AUTO_INCREMENT COMMENT '食品编号',
  `foodName` varchar(30) NOT NULL COMMENT '食品名称',
  `foodExplain` varchar(30) NOT NULL COMMENT '食品介绍',
  `foodImg` mediumtext NOT NULL COMMENT '食品图片',
  `foodPrice` decimal(5,2) NOT NULL COMMENT '食品价格',
  `businessId` int(11) NOT NULL COMMENT '所属商家编号',
  `remarks` varchar(40) DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`foodId`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of food
-- ----------------------------
BEGIN;
INSERT INTO `food` VALUES (1, '纯肉鲜肉（水饺）', '纯肉馅饺子', '', 16.00, 10001, NULL);
INSERT INTO `food` VALUES (2, '玉米鲜肉（水饺）', '玉米清香', '', 15.00, 10001, NULL);
INSERT INTO `food` VALUES (3, '虾仁三鲜（蒸饺）', '三鲜馅饺子', '', 20.00, 10001, NULL);
INSERT INTO `food` VALUES (4, '素三鲜（蒸饺）', '韭菜鸡蛋虾仁', '', 15.00, 10001, NULL);
INSERT INTO `food` VALUES (5, '角瓜鸡蛋（蒸饺）', '角瓜清香', '', 15.00, 10001, NULL);
INSERT INTO `food` VALUES (6, '小白菜肉（水饺）', '小白菜鲜肉', '', 16.00, 10001, NULL);
INSERT INTO `food` VALUES (7, '芹菜牛肉（水饺）', '芹菜牛肉', '', 22.00, 10001, NULL);
INSERT INTO `food` VALUES (8, '虾腰鲜肉（蒸饺）', '虾仁腰子', '', 25.00, 10001, NULL);
INSERT INTO `food` VALUES (9, '青椒鲜肉（蒸饺）', '青椒鲜肉', '', 18.00, 10001, NULL);
INSERT INTO `food` VALUES (10, '蛋黄焗豆花', '蛋黄豆花', '', 8.00, 10002, NULL);
INSERT INTO `food` VALUES (11, '麻婆豆腐', '麻辣味', '', 14.00, 10002, NULL);
INSERT INTO `food` VALUES (12, '广式小豆腐', '广东风味', '', 12.00, 10002, NULL);
COMMIT;

-- ----------------------------
-- Table structure for orderdetailet
-- ----------------------------
DROP TABLE IF EXISTS `orderdetailet`;
CREATE TABLE `orderdetailet` (
  `odId` int(11) NOT NULL AUTO_INCREMENT COMMENT '订单明细编号',
  `orderId` int(11) NOT NULL COMMENT '所属订单编号',
  `foodId` int(11) NOT NULL COMMENT '食品编号',
  `quantity` int(11) NOT NULL COMMENT '数量',
  PRIMARY KEY (`odId`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of orderdetailet
-- ----------------------------
BEGIN;
INSERT INTO `orderdetailet` VALUES (1, 1, 1, 2);
INSERT INTO `orderdetailet` VALUES (2, 1, 2, 3);
INSERT INTO `orderdetailet` VALUES (3, 2, 1, 20);
INSERT INTO `orderdetailet` VALUES (4, 5, 1, 20);
INSERT INTO `orderdetailet` VALUES (5, 6, 1, 3);
INSERT INTO `orderdetailet` VALUES (6, 6, 2, 3);
INSERT INTO `orderdetailet` VALUES (7, 6, 3, 2);
INSERT INTO `orderdetailet` VALUES (8, 7, 1, 1);
INSERT INTO `orderdetailet` VALUES (9, 7, 2, 1);
INSERT INTO `orderdetailet` VALUES (10, 7, 3, 1);
INSERT INTO `orderdetailet` VALUES (11, 8, 1, 1);
INSERT INTO `orderdetailet` VALUES (12, 8, 2, 1);
INSERT INTO `orderdetailet` VALUES (13, 8, 3, 2);
INSERT INTO `orderdetailet` VALUES (14, 9, 6, 7);
COMMIT;

-- ----------------------------
-- Table structure for orders
-- ----------------------------
DROP TABLE IF EXISTS `orders`;
CREATE TABLE `orders` (
  `orderId` int(11) NOT NULL AUTO_INCREMENT COMMENT '订单编号',
  `userId` varchar(20) NOT NULL COMMENT '用户编号',
  `businessId` int(11) NOT NULL COMMENT '商家编号',
  `orderDate` varchar(20) NOT NULL COMMENT '订购日期',
  `orderTotal` decimal(7,2) NOT NULL DEFAULT '0.00' COMMENT '订单总价',
  `daId` int(11) NOT NULL COMMENT '送货地址编号',
  `orderState` int(11) NOT NULL DEFAULT '0' COMMENT '订单状态（0：未支付； 1：已支付）',
  PRIMARY KEY (`orderId`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of orders
-- ----------------------------
BEGIN;
INSERT INTO `orders` VALUES (1, '11111111111', 10001, '2022-4-14', 0.00, 1, 1);
INSERT INTO `orders` VALUES (2, '11111111111', 10001, '2022-04-18 14:19:01', 2.00, 1, 0);
INSERT INTO `orders` VALUES (5, '11111111111', 10001, '2022-04-18 15:13:32', 2.00, 1, 0);
INSERT INTO `orders` VALUES (6, '11111111111', 10001, '2022-04-26 14:37:52', 136.00, 15, 0);
INSERT INTO `orders` VALUES (7, '11111111111', 10001, '2022-04-26 16:18:34', 54.00, 15, 0);
INSERT INTO `orders` VALUES (8, '11111111111', 10001, '2022-04-26 16:34:01', 74.00, 15, 0);
INSERT INTO `orders` VALUES (9, '11111111111', 10001, '2022-04-26 16:35:08', 115.00, 15, 0);
COMMIT;

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `userId` varchar(20) NOT NULL COMMENT '用户编号',
  `password` varchar(20) NOT NULL COMMENT '密码',
  `userName` varchar(20) NOT NULL COMMENT '用户名称',
  `userSex` int(11) NOT NULL DEFAULT '1' COMMENT '用户性别（1：男； 0：女）',
  `userImg` mediumtext COMMENT '用户头像',
  `delTag` int(1) NOT NULL DEFAULT '1' COMMENT '删除标记（1：正常； 0：删除）',
  PRIMARY KEY (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of user
-- ----------------------------
BEGIN;
INSERT INTO `user` VALUES ('11111111111', '123', '张三丰', 1, '', 1);
INSERT INTO `user` VALUES ('12345671111', '123', '张平', 1, '', 1);
INSERT INTO `user` VALUES ('12345672222', '123', '特没谱', 1, '', 1);
INSERT INTO `user` VALUES ('3333333333', '123456', 'fender', 1, NULL, 1);
INSERT INTO `user` VALUES ('4444444444', '123456', 'gibson', 0, NULL, 1);
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
